# _*_ coding utf-8 _*_
# FILENAME：.py
# DESCRIPTION: BOM Model
# AUTH: ZB
# DATE: 2022/6/2 10:00 下午

from sqlalchemy import Column, String, Integer, DECIMAL, DATETIME
from models.baseModel import BaseModel


## BOM主表
class BomModel(BaseModel):
    # 表的名字:
    __tablename__ = 'bom'
    # 表的结构:
    production_line = Column(Integer, comment='生产线 1：焊装 2：涂装 3：总装')
    version_name = Column(String(255), index=True, comment='版本名称')
    factory_id = Column(Integer, comment='工厂ID')
    # 添加索引和表注释
    __table_args__ = ({'comment': 'BOM主表'})


## BOM详情表
class BomDetailsModel(BaseModel):
    # 表的名字:
    __tablename__ = 'bom_details'
    # 表的结构:
    bom_id = Column(Integer, index=True, comment='BOM主表ID')
    car_model = Column(String(32), comment='车型代码')
    part_code = Column(String(32), comment='零件号')
    part_name = Column(String(64), comment='零件名称')
    per_number = Column(DECIMAL(10, 4), comment='单车零件用量')
    # 添加表注释
    __table_args__ = ({'comment': 'BOM详情表'})